

"""A set of functions assisting movement"""

NORTH = lambda x: (x[0] , x[1]- 1)
WEST = lambda x: (x[0] - 1, x[1])
SOUTH = lambda x: (x[0], x[1] + 1)
EAST = lambda x: (x[0] + 1, x[1])
ALL_DIRECTIONS = [NORTH, WEST, SOUTH, EAST]

def translate(direction, coordinates):
    """
    Returns a given point translated in the direction requested
    direction - One of movement.NORTH, movement.WEST, movement.SOUTH,
                movement.EAST
    coordinates - The coordinates to translate
    """
    return direction(coordinates)

def get_route(world, direction, coordinates):
    """
    Returns the route that must be travelled to do a given direction
    world - The world that is being travelled.
    direction - One of movement.NORTH, movement.WEST, movement.SOUTH,
                movement.EAST
    coordinates - The coordinates of the source
    """
    destination = translate(direction, coordinates)
    return world.get_route(coordinates[0], coordinates[1], destination[0], destination[1])